package com.ethink.order.converter;

import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import com.ethink.framework.common.converter.Converter;
import com.ethink.order.api.info.SaleOrderInfo;
import com.ethink.order.common.entity.SaleOrder;

/**
 * TOC销售单 Converter转换器
 *
 * @author default
 * @date 2022-11-22
 */
@Component
public class SaleOrderConverter implements Converter<SaleOrderInfo, SaleOrder> {

    @Override
    public SaleOrder convertTo(SaleOrderInfo info) {
        if(info == null) {
            return null;
        }
        SaleOrder entity = new SaleOrder ();
        BeanUtils.copyProperties(info, entity);
        return entity;
    }

    @Override
    public SaleOrderInfo convertFrom(SaleOrder entity) {
        if(entity == null) {
            return null;
        }
        SaleOrderInfo info = new SaleOrderInfo();
        BeanUtils.copyProperties(entity, info);
        return info;
    }
}
